<?php 
defined( '_VALID_NVB' ) or die( 'Direct Access to this location is not allowed.' );
$tpl = new TemplatePower("template/leftcol.html");
$tpl->prepare();
	$tpl->assignGlobal("site_address",$site_address);
	if($_GET['page']=='products'){
		$idc=intval($_REQUEST['idc']);
		$tpl->newBlock("box_page_product");
		$sql="SELECT * FROM catpd WHERE id_catpd=$idc";
		$db=$DB->query($sql);
		if($rs=mysql_fetch_array($db)){
			$tpl->assign("catname",$rs['name']);
			if ($rs['small_image']){
				$tpl->assign("image","<img alt='".clean_url($rs['name'])."' src='".$site_address.$CONFIG['upload_image_path'].$rs['small_image']."' align='left' border='0'  class='imagenews'  >");
			}		
		}
		
		$sql="SELECT * FROM filter WHERE id_catpd=$idc AND parentid=0 ORDER BY thu_tu DESC, name ASC";
		$db=$DB->query($sql);
		while($rs=mysql_fetch_array($db)){
			$tpl->newBlock("list_box");
			$tpl->assign("id",$rs['id_filter']);
			$sql1="SELECT * FROM filter WHERE parentid=$rs[id_filter] ORDER BY thu_tu DESC, name ASC";
			$db1=$DB->query($sql1);
			while($rs1=mysql_fetch_array($db1)){
				$tpl->newBlock("list_item_filter");
				$tpl->assign("name",$rs1['name']);	
				$pathold=Get_Main_CatPD_Name($rs1['id_catpd']);
				$pathnew=substr($pathold,0,strlen($pathold)-1);
				$tpl->assign("link_fil",$site_address.$pathnew."_".$rs1['id_filter']."_".$rs1['id_catpd']."_".$idmenu.".fil");
				
			}
		}
		
		// quang cao 
		$sql="SELECT * FROM catlg WHERE active=1 AND postion='advleftproduct' ORDER BY thu_tu DESC, name ASC";
		$db=$DB->query($sql);
		while($rs=mysql_fetch_array($db)){
			$sql1="SELECT * FROM logo WHERE active=1 AND id_catlg IN(".Get_Id_CatLG($rs['id_catlg']).") ORDER BY thu_tu DESC, name ASC";
			$db1=$DB->query($sql1);
			while($rs1=mysql_fetch_array($db1)){
				$tpl->newBlock("advleftproduct");
				if ($rs1['image']){
					$tpl->assign("imageadv","<img alt='".clean_url($rs1['name'])."' src='".$site_address.$CONFIG['upload_image_path'].$rs1['image']."' border='0'  width='150' height='108'>");
				}
				$tpl->assign("link",$rs1['link']);
				$tpl->assign("target",$rs1['target']);
			}
		}
		
		
	}else{
		$tpl->newBlock("box_other_product")	;
		// quang cao 
		$sql="SELECT * FROM catlg WHERE active=1 AND postion='advleft' ORDER BY thu_tu DESC, name ASC";
		$db=$DB->query($sql);
		while($rs=mysql_fetch_array($db)){
			$sql1="SELECT * FROM logo WHERE active=1 AND id_catlg IN(".Get_Id_CatLG($rs['id_catlg']).") ORDER BY thu_tu DESC, name ASC";
			$db1=$DB->query($sql1);
			while($rs1=mysql_fetch_array($db1)){
				$tpl->newBlock("advleft");
				if ($rs1['image']){
					$tpl->assign("imageadv","<img alt='".clean_url($rs1['name'])."' src='".$site_address.$CONFIG['upload_image_path'].$rs1['image']."' border='0'  width='150' height='108'>");
				}
				$tpl->assign("link",$rs1['link']);
				$tpl->assign("target",$rs1['target']);
			}
		}	
	}
	
$tpl->printToScreen();
?>